package cn.edu.scau.cmi.shishuai.singleton.view;


import cn.edu.scau.cmi.shishuai.singleton.model.Chairman;
import cn.edu.scau.cmi.shishuai.singleton.model.Marshal;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

public class SingletonController {
	@FXML
	private Button ChairmanButton;
	@FXML
	private Button MarshalButton;
	@FXML
	private TextArea  Text;
	@FXML
	private TextField  name;
	@FXML
	private void createChairman() {
	    Chairman chairman = Chairman.getInstance(name.getText()); 
	    String text = Text.getText();
	    Text.setText(text+"\r\n"+chairman.getName()+chairman.toString());

	}
	
	@FXML
	private void createMarshal() {
	    String text = Text.getText();	   
	    Text.setText(text+"\r\n"+name.getText()+Marshal.addInstance(name.getText()).toString());	    	    
	}
}
